.class public Lcom/brixd/niceapp/util/RequestDelayHandler;
.super Ljava/lang/Object;
.source "RequestDelayHandler.java"


# static fields
.field private static final DEFAULT_DETAYL:I = 0x12c


# instance fields
.field private mDelayRequestMap:Ljava/util/HashMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/Object;",
            "Ljava/lang/Boolean;",
            ">;"
        }
    .end annotation
.end field

.field private mDelayTime:I

.field private mHandler:Landroid/os/Handler;

.field private mRequestintMap:Ljava/util/HashMap;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/HashMap",
            "<",
            "Ljava/lang/Object;",
            "Ljava/lang/Boolean;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>()V
    .registers 2

    .prologue
    .line 17
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 10
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    iput-object v0, p0, Lcom/brixd/niceapp/util/RequestDelayHandler;->mRequestintMap:Ljava/util/HashMap;

    .line 11
    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    iput-object v0, p0, Lcom/brixd/niceapp/util/RequestDelayHandler;->mDelayRequestMap:Ljava/util/HashMap;

    .line 18
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    iput-object v0, p0, Lcom/brixd/niceapp/util/RequestDelayHandler;->mHandler:Landroid/os/Handler;

    .line 19
    const/16 v0, 0x12c

    iput v0, p0, Lcom/brixd/niceapp/util/RequestDelayHandler;->mDelayTime:I

    .line 20
    return-void
.end method

.method static synthetic access$000(Lcom/brixd/niceapp/util/RequestDelayHandler;)Ljava/util/HashMap;
    .registers 2
    .param p0, "x0"    # Lcom/brixd/niceapp/util/RequestDelayHandler;

    .prologue
    .line 7
    iget-object v0, p0, Lcom/brixd/niceapp/util/RequestDelayHandler;->mDelayRequestMap:Ljava/util/HashMap;

    return-object v0
.end method

.method private delayAllowNextRequest(Ljava/lang/Object;)V
    .registers 6
    .param p1, "requestTag"    # Ljava/lang/Object;

    .prologue
    .line 58
    iget-object v0, p0, Lcom/brixd/niceapp/util/RequestDelayHandler;->mHandler:Landroid/os/Handler;

    new-instance v1, Lcom/brixd/niceapp/util/RequestDelayHandler$1;

    invoke-direct {v1, p0, p1}, Lcom/brixd/niceapp/util/RequestDelayHandler$1;-><init>(Lcom/brixd/niceapp/util/RequestDelayHandler;Ljava/lang/Object;)V

    iget v2, p0, Lcom/brixd/niceapp/util/RequestDelayHandler;->mDelayTime:I

    int-to-long v2, v2

    invoke-virtual {v0, v1, v2, v3}, Landroid/os/Handler;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 65
    return-void
.end method


# virtual methods
.method public declared-synchronized endRequest(Ljava/lang/Object;)V
    .registers 3
    .param p1, "requestTag"    # Ljava/lang/Object;

    .prologue
    .line 34
    monitor-enter p0

    :try_start_1
    iget-object v0, p0, Lcom/brixd/niceapp/util/RequestDelayHandler;->mRequestintMap:Ljava/util/HashMap;

    invoke-virtual {v0, p1}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_6
    .catchall {:try_start_1 .. :try_end_6} :catchall_8

    .line 35
    monitor-exit p0

    return-void

    .line 34
    :catchall_8
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized isAbleToRequest(Ljava/lang/Object;)Z
    .registers 9
    .param p1, "requestTag"    # Ljava/lang/Object;

    .prologue
    const/4 v4, 0x1

    const/4 v5, 0x0

    .line 48
    monitor-enter p0

    :try_start_3
    iget-object v6, p0, Lcom/brixd/niceapp/util/RequestDelayHandler;->mRequestintMap:Ljava/util/HashMap;

    invoke-virtual {v6, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Ljava/lang/Boolean;

    .line 49
    .local v3, "requestingValue":Ljava/lang/Boolean;
    iget-object v6, p0, Lcom/brixd/niceapp/util/RequestDelayHandler;->mDelayRequestMap:Ljava/util/HashMap;

    invoke-virtual {v6, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Boolean;
    :try_end_13
    .catchall {:try_start_3 .. :try_end_13} :catchall_2a

    .line 51
    .local v0, "ableToRequestValue":Ljava/lang/Boolean;
    if-nez v3, :cond_1e

    move v2, v5

    .line 52
    .local v2, "isRequesting":Z
    :goto_16
    if-nez v0, :cond_23

    move v1, v4

    .line 54
    .local v1, "isAbleToRequest":Z
    :goto_19
    if-nez v2, :cond_28

    :goto_1b
    and-int/2addr v4, v1

    monitor-exit p0

    return v4

    .line 51
    .end local v1    # "isAbleToRequest":Z
    .end local v2    # "isRequesting":Z
    :cond_1e
    :try_start_1e
    invoke-virtual {v3}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v2

    goto :goto_16

    .line 52
    .restart local v2    # "isRequesting":Z
    :cond_23
    invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z
    :try_end_26
    .catchall {:try_start_1e .. :try_end_26} :catchall_2a

    move-result v1

    goto :goto_19

    .restart local v1    # "isAbleToRequest":Z
    :cond_28
    move v4, v5

    .line 54
    goto :goto_1b

    .line 48
    .end local v0    # "ableToRequestValue":Ljava/lang/Boolean;
    .end local v1    # "isAbleToRequest":Z
    .end local v2    # "isRequesting":Z
    .end local v3    # "requestingValue":Ljava/lang/Boolean;
    :catchall_2a
    move-exception v4

    monitor-exit p0

    throw v4
.end method

.method public declared-synchronized isRequesting(Ljava/lang/Object;)Z
    .registers 4
    .param p1, "requestTag"    # Ljava/lang/Object;

    .prologue
    .line 43
    monitor-enter p0

    :try_start_1
    iget-object v1, p0, Lcom/brixd/niceapp/util/RequestDelayHandler;->mRequestintMap:Ljava/util/HashMap;

    invoke-virtual {v1, p1}, Ljava/util/HashMap;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Boolean;
    :try_end_9
    .catchall {:try_start_1 .. :try_end_9} :catchall_13

    .line 44
    .local v0, "ret":Ljava/lang/Boolean;
    if-nez v0, :cond_e

    const/4 v1, 0x0

    :goto_c
    monitor-exit p0

    return v1

    :cond_e
    :try_start_e
    invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z
    :try_end_11
    .catchall {:try_start_e .. :try_end_11} :catchall_13

    move-result v1

    goto :goto_c

    .line 43
    .end local v0    # "ret":Ljava/lang/Boolean;
    :catchall_13
    move-exception v1

    monitor-exit p0

    throw v1
.end method

.method public declared-synchronized resetRequest(Ljava/lang/Object;)V
    .registers 3
    .param p1, "requestTag"    # Ljava/lang/Object;

    .prologue
    .line 38
    monitor-enter p0

    :try_start_1
    iget-object v0, p0, Lcom/brixd/niceapp/util/RequestDelayHandler;->mRequestintMap:Ljava/util/HashMap;

    invoke-virtual {v0, p1}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;

    .line 39
    iget-object v0, p0, Lcom/brixd/niceapp/util/RequestDelayHandler;->mDelayRequestMap:Ljava/util/HashMap;

    invoke-virtual {v0, p1}, Ljava/util/HashMap;->remove(Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_b
    .catchall {:try_start_1 .. :try_end_b} :catchall_d

    .line 40
    monitor-exit p0

    return-void

    .line 38
    :catchall_d
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public setDelayTime(I)V
    .registers 2
    .param p1, "delay"    # I

    .prologue
    .line 23
    iput p1, p0, Lcom/brixd/niceapp/util/RequestDelayHandler;->mDelayTime:I

    .line 24
    return-void
.end method

.method public declared-synchronized startRequest(Ljava/lang/Object;)V
    .registers 4
    .param p1, "requestTag"    # Ljava/lang/Object;

    .prologue
    .line 27
    monitor-enter p0

    :try_start_1
    iget-object v0, p0, Lcom/brixd/niceapp/util/RequestDelayHandler;->mRequestintMap:Ljava/util/HashMap;

    const/4 v1, 0x1

    invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v1

    invoke-virtual {v0, p1, v1}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 28
    iget-object v0, p0, Lcom/brixd/niceapp/util/RequestDelayHandler;->mDelayRequestMap:Ljava/util/HashMap;

    const/4 v1, 0x0

    invoke-static {v1}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v1

    invoke-virtual {v0, p1, v1}, Ljava/util/HashMap;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    .line 30
    invoke-direct {p0, p1}, Lcom/brixd/niceapp/util/RequestDelayHandler;->delayAllowNextRequest(Ljava/lang/Object;)V
    :try_end_18
    .catchall {:try_start_1 .. :try_end_18} :catchall_1a

    .line 31
    monitor-exit p0

    return-void

    .line 27
    :catchall_1a
    move-exception v0

    monitor-exit p0

    throw v0
.end method
